home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / Information / CSMP Digest / volume 1 / csmp-v1-223.txt < prev    next >
Encoding:
Text File  |  1994-12-08  |  34.1 KB  |  831 lines  |  [TEXT/R*ch]

  1. C.S.M.P. Digest             Sat, 12 Dec 92       Volume 1 : Issue 223
  2.  
  3. Today's Topics:
  4.  
  5.     Flattened (Single Fork) QuickTime Movies
  6.     Powerbook track ball buttons (click and hold)
  7.     ETO#8, Dinker & SLM (Shared Library Manager) ?
  8.     Super-Floating Windows
  9.     Spurious invalidation
  10.  
  11.  
  12.  
  13. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  14.  
  15. The digest is a collection of article threads from the internet newsgroup
  16. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  17. regularly and want an archive of the discussions.  If you don't know what a
  18. newsgroup is, you probably don't have access to it.  Ask your systems
  19. administrator(s) for details.  You can post articles to any newsgroup by
  20. mailing your article to newsgroup@ucbvax.berkeley.edu.  So, to post an
  21. article to comp.sys.mac.programmer, you mail it to
  22. comp-sys-mac-programmer@ucbvax.berkeley.edu.  Note the '-' instead of '.'
  23. in the newsgroup name.
  24.  
  25. Each issue of the digest contains one or more sets of articles (called
  26. threads), with each set corresponding to a 'discussion' of a particular
  27. subject.  The articles are not edited; all articles included in this digest
  28. are in their original posted form (as received by our news server at
  29. cs.uoregon.edu).  Article threads are not added to the digest until the last
  30. article added to the thread is at least one month old (this is to ensure that
  31. the thread is dead before adding it to the digest).  Article threads that
  32. consist of only one message are generally not included in the digest.
  33.  
  34. The entire digest is available for anonymous ftp from ftp.cs.uoregon.edu
  35. [128.223.8.8] in the directory /pub/mac/csmp-digest.  Be sure to read the
  36. file /pub/mac/csmp-digest/README before downloading any files.  The most
  37. recent issues are available from sumex-aim.stanford.edu [36.44.0.6] in the
  38. directory /info-mac/digest/csmp.  If you don't have ftp capability, the sumex
  39. archive has a mail server; send a message with the text '$MACarch help' (no
  40. quotes) to LISTSERV@ricevm1.rice.edu for more information.
  41.  
  42. The digest is also available via email.  Just send a note saying that you
  43. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  44. automatically receive each new issue as it is created.  Sorry, back issues
  45. are not available through the mailing list.
  46.  
  47. Send administrative mail to mkelly@cs.uoregon.edu.
  48.  
  49.  
  50. -------------------------------------------------------
  51.  
  52. From: davew@uswest.com (David Wroblewski)
  53. Subject: Flattened (Single Fork) QuickTime Movies
  54. Date: 5 Nov 92 01:31:15 GMT
  55. Organization: U S WEST Advanced Technologies
  56.  
  57. Does anyone have experience using the QuickTime FlattenMovie function to 
  58. create single fork ("flattened") movie files?  I am experiencing a possible
  59. bug, or at least obscure behavior.
  60.  
  61. The behavior is this:  I flatten ordinary movie file A using a little custom program 
  62. that simply calls FlattenMovie, (producing file B) then FTP B round trip 
  63. (in binary mode) to a Unix machine and back (producing file C). A, B, and C all
  64. have different names on my disk. 
  65.  
  66. Now I delete file B.  
  67.  
  68. Now Simple Player (and other players) fail trying to play the movie from file C, popping 
  69. up the standard "Looking for movie file B" dialog that Quicktime shows when it can't 
  70. quickly resolve a reference to a data file. Of course, I think that QuickTime should be 
  71. finding the self-same file (C) I told Simple Player to open, but it won't accept that answer,
  72. it wants file B.  If I rename C to B, Simple Player can play it perfectly.
  73.  
  74. My theory is that somewhere inside the flattened movie file is an alias or other reference
  75. to the flattened movie file B, which wasn't changed via the FlattenMovie procedure.
  76. Since FlattenMovie was included in QuickTime exactly to handle the case of moving 
  77. movies to other (non-mac) file systems, this seems like a bug to me, and since I want to 
  78. write a "movie server" that can hand off movies to anyone who asks, without dictating the 
  79. name of the file it gets stored in, this is causing me real grief.
  80.  
  81. Has anyone else seen this, have ideas about what might cause it, or thoughts on how
  82. I might debug it?  Pointers to public domain code that flattens movies would also be
  83. appreciated, on the off chance that I am not using FlattenMovie correctly.
  84.  
  85. Thanks in advance.
  86.  
  87. David Wroblewski
  88. U S WEST Advanced Technologies
  89. Boulder, CO 80303
  90. (303) 541-6008
  91. davew@uswest.com
  92.  
  93. +++++++++++++++++++++++++++
  94.  
  95. From: evans@Apple.COM (John Evans)
  96. Date: 5 Nov 92 21:59:33 GMT
  97. Organization: Apple Computer Inc., Cupertino, CA
  98.  
  99. This was a bug in QuickTime 1.0 that hurt me once.  When you flatten a movie
  100. and you ask it to include everything in the data fork, QT is supposed to set
  101. a bit in the movie telling it to reference this new file and not use the 
  102. references to the old data files.  This was called something like the
  103. "Self-Reference" bit.  Unfortunately, this bit was not being set in QT 1.0.
  104.  
  105. I'm not sure if there's any good way around this.  I know that this bug has
  106. been fixed in QT 1.5.
  107.  
  108. Good luck!
  109. - -- 
  110. +========================+===============================================+
  111. | John S. Evans          | These opinions are mine. Apple's opinions are |
  112. | Collaborative Systems  | Apple's.  Any similarity is coincidental.     |
  113. | Apple Computer, Inc    | "Why does it happen?  Because it happens.     |
  114. | evans@apple.com        |  Roll the bones."                       -Rush |
  115. +========================+===============================================+
  116.  
  117. ---------------------------
  118.  
  119. From: david@oahu.cs.ucla.edu (David Dantowitz)
  120. Subject: Powerbook track ball buttons (click and hold)
  121. Date: 3 Nov 92 12:48:26 GMT
  122. Organization: UCLA, Computer Science Department
  123.  
  124.  
  125. Has anyone written a trackball hack (similar to the Kensington hack)
  126. that allows you to have one of the track ball buttons click and hold?
  127.  
  128. Alternatively, how does one differentiate between the two buttons?
  129.  
  130. Thanks.
  131.  
  132. - -- 
  133. David Dantowitz
  134. david@cs.ucla.edu
  135.  
  136. Singing Barbershop when I'm not doing parallel simulation
  137.  
  138. +++++++++++++++++++++++++++
  139.  
  140. From: cklarson@flauta.engr.ucdavis.edu (Christopher Klaus Larson)
  141. Date: 5 Nov 92 20:56:19 GMT
  142. Organization: College of Engineering - University of California - Davis
  143.  
  144. In article <1992Nov3.124826.26965@cs.ucla.edu> david@oahu.cs.ucla.edu (David Dantowitz) writes:
  145. >
  146. >Has anyone written a trackball hack (similar to the Kensington hack)
  147. >that allows you to have one of the track ball buttons click and hold?
  148. >
  149. >Alternatively, how does one differentiate between the two buttons?
  150. >
  151.  
  152. I don't know about the new PB's (160,180,210,230) but in the older
  153. models the two buttons were physically wired together so there is *no*
  154. way to tell them apart from inside the machine.
  155.  
  156. - --Chris
  157. cklarson@engr.ucdavis.edu
  158.  
  159. +++++++++++++++++++++++++++
  160.  
  161. From: andyc@ai.mit.edu (Andrew D. Christian)
  162. Date: 6 Nov 92 12:31:53
  163. Organization: MIT Artificial Intelligence Laboratory
  164.  
  165.  
  166. In article <18921@ucdavis.ucdavis.edu> cklarson@flauta.engr.ucdavis.edu (Christopher Klaus Larson) writes:
  167.  
  168.    I don't know about the new PB's (160,180,210,230) but in the older
  169.    models the two buttons were physically wired together so there is *no*
  170.    way to tell them apart from inside the machine.
  171.  
  172. At a talk the other week, David Levy (who designed the trackball for
  173. the Duos) mentioned that the buttons on the PB 210 & 230 are in fact
  174. electrically separate, but the driver software currently doesn't
  175. discriminate between them.
  176.  
  177.         Andrew Christian
  178.         andyc@ai.mit.edu
  179.  
  180. - --
  181.  
  182.  
  183.          - Andy
  184.  
  185. ---------------------------
  186.  
  187. From: louis@asterix.drev.dnd.ca (Louis Demers)
  188. Subject: ETO#8, Dinker & SLM (Shared Library Manager) ?
  189. Date: 5 Nov 92 13:00:12 GMT
  190. Organization: Defence Research Establishment Valcartier
  191.  
  192. Hi,
  193.  
  194.     Even after reading the documentation of both packages, I still
  195.     have some difficulty in seeing the difference between Dinker
  196.     and the shared Library Manager. Can anybody explain what
  197.     differences there are ? 
  198.  
  199.         Also, while I understand that these are unsupported,  What
  200.     future do you see for those packages ?  I would be very interested
  201.     in basing our next project on the SLM, but what will
  202.     happen if Apple gets tired of it and doesn't support it
  203.     anymore ? Will the application be easily converted to a normally
  204.     linked application ?
  205.  
  206.         Thanks
  207. - -- 
  208. | Louis Demers              | DREV, Defence Research Establishment,Valcartier |
  209. | louis@asterix.drev.dnd.ca | POBox 8800, Courcelette,Quebec, CANADA, G0A 1R0 |
  210. |            (131.132.48.2) | Office: (418) 844-4424       fax (418) 844-4511 |
  211. +---------------------------+-------------------------------------------------+
  212.  
  213. +++++++++++++++++++++++++++
  214.  
  215. From: leonardr@netcom.com (Leonard Rosenthol)
  216. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  217. Date: Thu, 5 Nov 1992 18:50:24 GMT
  218.  
  219. In article <1992Nov5.130012.14941@asterix.drev.dnd.ca> louis@asterix.drev.dnd.ca (Louis Demers) writes:
  220. >    Even after reading the documentation of both packages, I still
  221. >    have some difficulty in seeing the difference between Dinker
  222. >    and the shared Library Manager. Can anybody explain what
  223. >    differences there are ? 
  224. >
  225.     Although not a technical difference, the most important difference
  226. is that the SLM was done in house at Apple (while Dinker was an outside
  227. project) and that Apple has (sort of) standardied on the SLM as the "shared
  228. library" scheme of choice for the Mac.  You will see future System Software
  229. based on the SLM.
  230.  
  231. >        Also, while I understand that these are unsupported,  What
  232. >    future do you see for those packages ?  I would be very interested
  233. >    in basing our next project on the SLM, but what will
  234. >    happen if Apple gets tired of it and doesn't support it
  235. >    anymore ? Will the application be easily converted to a normally
  236. >    linked application ?
  237. >
  238.     As noted above, the SLM will not be going away anytime soon.
  239.  
  240.  
  241. - -- 
  242. - -----------------------------------------------------------------------------
  243. Leonard Rosenthol            Internet:     leonardr@netcom.com
  244. Director of Advanced Technology        AppleLink:    MACgician
  245. Aladdin Systems, Inc.            GEnie:        MACgician
  246.  
  247.  
  248. +++++++++++++++++++++++++++
  249.  
  250. From: ksand@apple.com (Kent Sandvik )
  251. Date: Sat, 7 Nov 1992 07:32:01 GMT
  252. Organization: Apple
  253.  
  254. In article <1992Nov5.185024.13860@netcom.com>, leonardr@netcom.com (Leonard
  255. Rosenthol) wrote:
  256. > In article <1992Nov5.130012.14941@asterix.drev.dnd.ca> louis@asterix.drev.dnd.ca (Louis Demers) writes:
  257. > >    Even after reading the documentation of both packages, I still
  258. > >    have some difficulty in seeing the difference between Dinker
  259. > >    and the shared Library Manager. Can anybody explain what
  260. > >    differences there are ? 
  261.  
  262. >     Although not a technical difference, the most important difference
  263. > is that the SLM was done in house at Apple (while Dinker was an outside
  264. > project) and that Apple has (sort of) standardied on the SLM as the "shared
  265. > library" scheme of choice for the Mac.  You will see future System Software
  266. > based on the SLM.
  267.  
  268. Yes, Dinker was done by Apple ATG/East Coast for a special project. It was
  269. never the intention to state Dinker as an official dynamic linking
  270. system for MacOS.
  271.  
  272. > >        Also, while I understand that these are unsupported,  What
  273. > >    future do you see for those packages ?  I would be very interested
  274. > >    in basing our next project on the SLM, but what will
  275. > >    happen if Apple gets tired of it and doesn't support it
  276. > >    anymore ? Will the application be easily converted to a normally
  277. > >    linked application ?
  278.  
  279. >     As noted above, the SLM will not be going away anytime soon.
  280.  
  281. Versions are available on ETOs, the next ETO (#9) will have a totally
  282. revised version how to create shared library functions. Anyone who
  283. read my MADA Frameworks article, forget 50% of the techniques, they 
  284. are revised (sigh),  but it's actually now much easier to convert
  285. code to SLM use. For instance, you don't need to write special
  286. constructor/destructor .cp files.
  287.  
  288. Kent
  289. - -------------------
  290. Kent Sandvik (UUCP: ....!apple!ksand; INTERNET: ksand@apple.com)
  291. DISCLAIMER: Private activities on the Net.
  292.  
  293. ---------------------------
  294.  
  295. From: dsb@osustat.mps.ohio-state.edu (David S. Blumenthal)
  296. Subject: Super-Floating Windows
  297. Date: 4 Nov 92 20:51:19 GMT
  298. Organization: OSU Statistical Computing Laboratory
  299.  
  300. I am writing a "virtual keyboard" utility that will emulate a keyboard
  301. on screen.  I would very much like to have the keyboard in a window that
  302. remains fully visible and accessible at all times.  Sounds like a floating
  303. window?
  304.  
  305. OK.  Here's the trick.  The window stays in the front, no matter what
  306. application is running.  The window itself is not associated with the
  307. current application, however.  The utility will receive clicks in its
  308. window, but will not cause the current application to move out of the
  309. foreground.
  310.  
  311. What is the best way to do this?  Should I be kludging with jWNEFilters
  312. to intercept events?  Should this be an application proper that does
  313. something weird to not be brought to the front?  Can I do this with a
  314. background only application (that has a window)?
  315.  
  316. I once saw First Things First doing this, I think.  Does anyone know how
  317. they do it?  That would be pretty close to what I hope to achieve.
  318.  
  319. Thanks a lot.  Sorry about the length of this.
  320.  
  321. - -----------------------------------------------------------------------
  322. | Dave Blumenthal                  | The Ohio State University        |
  323. | dsb@osustat.mps.ohio-state.edu   | Statistical Computing Laboratory |
  324. - ------ There is a fine difference between insight and insanity. -------
  325.  
  326. The above post is not intended to represent my employer in any way.
  327.  
  328. +++++++++++++++++++++++++++
  329.  
  330. From: leonardr@netcom.com (Leonard Rosenthol)
  331. Date: 4 Nov 92 23:31:41 GMT
  332. Organization: Netcom - Online Communication Services  (408 241-9760 guest)
  333.  
  334. In article <1d9d47INN241@zaphod.mps.ohio-state.edu> dsb@osustat.mps.ohio-state.edu (David S. Blumenthal) writes:
  335. >I am writing a "virtual keyboard" utility that will emulate a keyboard
  336. >on screen.  I would very much like to have the keyboard in a window that
  337. >remains fully visible and accessible at all times.  
  338. >
  339. >OK.  Here's the trick.  The window stays in the front, no matter what
  340. >application is running.  The window itself is not associated with the
  341. >current application, however.  
  342. >
  343. >What is the best way to do this?  
  344. >
  345.     The best way to do it is NOT to do it.  Doing a "super floating
  346. window" (as you call it) involves a LOT of tricking of the system (and the
  347. applications as well) including about a half-dozen (or more) trap patches,
  348. changs to the "Macintosh Drawing Environment", and then dealing with programs
  349. like MSWord 4.0 which do really stupid things (like scrolling screenbits when
  350. the user clicks in the documents scroll bar).
  351.  
  352.  
  353. >I once saw First Things First doing this, I think.  Does anyone know how
  354. >they do it?  That would be pretty close to what I hope to achieve.
  355. >
  356.     It does all of the "sick hacks" that I talk about above.  
  357.  
  358.     Historical Note: The concept of a "super floater" was first done at 
  359. MacHack '88 (wow, long time!) when Darin Adler (formerly of Apple, now of 
  360. General Magic) an Sean Parent (now of Apple) wrote a hack called "Overtime" 
  361. which was a clock which floated over EVERYTHING.
  362.  
  363. - -- 
  364. - -----------------------------------------------------------------------------
  365. Leonard Rosenthol            Internet:     leonardr@netcom.com
  366. Director of Advanced Technology        AppleLink:    MACgician
  367. Aladdin Systems, Inc.            GEnie:        MACgician
  368.  
  369. +++++++++++++++++++++++++++
  370.  
  371. From: rson@rhi.hi.is (Mimir Reynisson)
  372. Date: 6 Nov 92 08:42:13 GMT
  373.  
  374. Punch a hole in the GrayRgn and do all your drawing in it. The window
  375. manager will respect that hole at all times.
  376.  
  377. +++++++++++++++++++++++++++
  378.  
  379. From: grobbins@Apple.COM (Grobbins)
  380. Date: 7 Nov 92 08:46:26 GMT
  381. Organization: Macintosh Hired Gun
  382.  
  383. In article <5570@krafla.rhi.hi.is> rson@rhi.hi.is (Mimir Reynisson) writes:
  384. >Punch a hole in the GrayRgn and do all your drawing in it. The window
  385. >manager will respect that hole at all times.
  386.  
  387. This method is problematic.  For one thing, removing a portion of a
  388. monitor from the gray region will confuse the Finder, and it will start
  389. repositioning any icons which happened to have been located under that
  390. window.
  391.  
  392. Another issue is that, once your window is off the gray region, the
  393. window manager wants nothing to do with you, so you end up doing most
  394. window management chores manually.
  395.  
  396. The most serious problem is that punching a hole assumes that you can
  397. unpunch the hole later (if the window moves or closes).  That requires
  398. knowing what the gray region should be, but what it was when you
  399. punched the hole may not be what it is when you attempt to unpunch the
  400. hole.  (The gray rgn changes if, say, one of the monitors has moved.)
  401. It is not safe to assume that the gray region should be restored to
  402. whatever it was when the hole was punched.
  403.  
  404. Sorry, but at present I don't know of a good answer on how to proceed
  405. on this.
  406.  
  407.  
  408. Grobbins                 grobbins@apple.com
  409.  
  410. Usual disclaimers apply.
  411.  
  412.  
  413. +++++++++++++++++++++++++++
  414.  
  415. From: siegel@world.std.com (Rich Siegel)
  416. Date: 7 Nov 92 18:56:17 GMT
  417. Organization: GCC Technologies
  418.  
  419. In article <74077@apple.Apple.COM> grobbins@Apple.COM (Grobbins) writes:
  420.  
  421. >The most serious problem is that punching a hole assumes that you can
  422. >unpunch the hole later (if the window moves or closes).  That requires
  423. >knowing what the gray region should be, but what it was when you
  424. >punched the hole may not be what it is when you attempt to unpunch the
  425. >hole.  (The gray rgn changes if, say, one of the monitors has moved.)
  426. >It is not safe to assume that the gray region should be restored to
  427. >whatever it was when the hole was punched.
  428.  
  429. Actually, monitors can't move except across restarts of the system, so
  430. unless some other program messes with the GrayRgn, you can probably
  431. un-punch your hole. It isn't safe to simply restore the GrayRgn, but
  432. you can probably UnionRgn the punched hole back in.
  433.  
  434. R.
  435.  
  436.  
  437. - -- 
  438. - -----------------------------------------------------------------------
  439. Rich Siegel                              Internet: siegel@world.std.com
  440. Software Engineer & Toolsmith
  441. GCC Technologies
  442.  
  443. +++++++++++++++++++++++++++
  444.  
  445. From: grobbins@Apple.COM (Grobbins)
  446. Date: 8 Nov 92 04:00:24 GMT
  447. Organization: Mac Look & Feel, Apple Computer, Inc.
  448.  
  449. In article <BxD0Lu.Bzw@world.std.com> siegel@world.std.com (Rich Siegel) writes:
  450. >Actually, monitors can't move except across restarts of the system, so
  451. >unless some other program messes with the GrayRgn, you can probably
  452. >un-punch your hole. It isn't safe to simply restore the GrayRgn, but
  453. >you can probably UnionRgn the punched hole back in.
  454.  
  455. Looking towards the future, this is not a good assumption.  Do not
  456. assume that the GrayRgn is static or that monitors cannot move.
  457.  
  458.  
  459. Grobbins                       grobbins@apple.com
  460.  
  461. Usual disclaimers apply.
  462.  
  463.  
  464.  
  465. +++++++++++++++++++++++++++
  466.  
  467. From: REEKES@applelink.apple.com (Jim Reekes)
  468. Date: Mon, 9 Nov 1992 21:00:38 GMT
  469. Organization: Apple Computer, Inc.
  470.  
  471. In article <BxD0Lu.Bzw@world.std.com>, siegel@world.std.com (Rich Siegel)
  472. wrote:
  473. > In article <74077@apple.Apple.COM> grobbins@Apple.COM (Grobbins) writes:
  474. > >The most serious problem is that punching a hole assumes that you can
  475. > >unpunch the hole later (if the window moves or closes).  That requires
  476. > >knowing what the gray region should be, but what it was when you
  477. > >punched the hole may not be what it is when you attempt to unpunch the
  478. > >hole.  (The gray rgn changes if, say, one of the monitors has moved.)
  479. > >It is not safe to assume that the gray region should be restored to
  480. > >whatever it was when the hole was punched.
  481. > Actually, monitors can't move except across restarts of the system, so
  482.  
  483. Well, I would say that monitors currently might not move, but don't make
  484. any assumptions about the future.  Also, don't the Radius Pivot "move"
  485. the monitor?
  486.  
  487. - -----------------------------------------------------------------------
  488. Jim Reekes, Polterzeitgeist  |     Macintosh Toolbox Engineering
  489.                              |          Sound Manager Expert
  490. Apple Computer, Inc.         | "All opinions expressed are mine, and do
  491. 20525 Mariani Ave. MS: 81-KS |   not necessarily represent those of my
  492. Cupertino, CA 95014          |       employer, Apple Computer Inc."
  493.  
  494. +++++++++++++++++++++++++++
  495.  
  496. From: ericsc@microsoft.com (Eric Schlegel)
  497. Date: 09 Nov 92 16:54:23 GMT
  498. Organization: Microsoft Corporation
  499.  
  500. In article <1d9d47INN241@zaphod.mps.ohio-state.edu> dsb@osustat.mps.ohio-state.edu (David S. Blumenthal) writes:
  501. >I am writing a "virtual keyboard" utility that will emulate a keyboard
  502. >on screen.  I would very much like to have the keyboard in a window that
  503. >remains fully visible and accessible at all times.  Sounds like a floating
  504. >window?
  505. >
  506. >OK.  Here's the trick.  The window stays in the front, no matter what
  507. >application is running.  The window itself is not associated with the
  508. >current application, however.  The utility will receive clicks in its
  509. >window, but will not cause the current application to move out of the
  510. >foreground.
  511.  
  512. This would be a perfect application of an input method, as supported by
  513. the Text Services manager in System 7.1. The Text Services manager is
  514. designed to do exactly what you want. The drawback, of course, is that
  515. you have to require 7.1. Documentation is also rather scarce at this point -
  516. I think only people who get the monthly developer mailing from Apple have
  517. gotten the 7.1 seed disks so far. Hopefully the Developer CDs will have
  518. information soon, though.
  519.  
  520. - -eric
  521. - -------
  522. My opinions, not Microsoft's.
  523.  
  524. +++++++++++++++++++++++++++
  525.  
  526. From: rson@rhi.hi.is (Mimir Reynisson)
  527. Date: 10 Nov 92 16:05:27 GMT
  528.  
  529. You can do a UnionRgn and then call PaintBehind() to force the window
  530. manager to update its windows and redraw the desktop. Actually the
  531. window Manager ignores the grayrgn. You can see it if you
  532. punch a whole in your grayrgn and then go and select a menu.
  533. It draws right over your window, silly menu manager :)
  534.  
  535. +++++++++++++++++++++++++++
  536.  
  537. From: dsb@osustat.mps.ohio-state.edu (David S. Blumenthal)
  538. Date: 10 Nov 1992 21:08:06 GMT
  539. Organization: OSU Statistical Computing Laboratory
  540.  
  541. Thanks to all who have contributed to this thread so far.  It has helped me
  542. out immensely.
  543.  
  544. I've done some testing with the "hole in GrayRgn" approach, and it works
  545. sufficiently.  I think that as long as the part of GrayRgn that the window
  546. removes does not stop corresponding to a piece of a monitor, there shouldn't
  547. be any foreseeable problems.  If it does, however, any window in that area
  548. will be affected.
  549.  
  550. As pointed out, menus function correctly over the affected region.  However,
  551. the window manager does not ignore GrayRgn - update events are not generated
  552. for my window.  Does anyone have any good ideas on how to determine when part
  553. of my window must be redrawn?  Do InvalRect and InvalRgn check for intersection
  554. with GrayRgn?  If not, could I check for intersection between my holeRgn and
  555. the window port's updateRgn?  When would I do this?
  556.  
  557. The only other events I am interested in are mouseDown and mouseUp.  These get
  558. to the window without regard to GrayRgn.  In order to catch all clicks over my
  559. window, regardless of what would normally overlap, and of what application is
  560. frontmost, I will patch SystemEvent and check theEvent.where (as suggested by
  561. the UseNet Mac Programming Guide).
  562.  
  563. I really appreciate your comments.
  564.  
  565. - -----------------------------------------------------------------------
  566. | Dave Blumenthal                  | The Ohio State University        |
  567. | dsb@osustat.mps.ohio-state.edu   | Statistical Computing Laboratory |
  568. - ------ There is a fine difference between insight and insanity. -------
  569.  
  570. ---------------------------
  571.  
  572. From: fixer@faxcsl.dcrt.nih.gov (Chris Spiral Catfish Tate)
  573. Subject: Spurious invalidation
  574. Organization: Computer Systems Laboratory, DCRT, NIH
  575. Date: Fri, 6 Nov 1992 17:02:32 GMT
  576.  
  577. Situation: modal dialog, System 7.0.1, Mac IIfx
  578.  
  579. Problem: calling SetCTitle() (and possibly SetCtlValue()) on controls in the
  580. dialog is forcing an update.  This is pretty bad in my case, since redrawing
  581. the dialog is rather time-consuming.
  582.  
  583. Is this *really* what's happening?  According to the THINK C debugger, I'm
  584. never calling InvalRect() or any of its relatives explicitly, but sure enough,
  585. my userItem update routines are getting called the next time through
  586. ModalDialog() after calling SetCTitle().
  587.  
  588. Does anyone have any idea what's happening, and how I might go about preventing
  589. it?  Calling ValidRect() on the slow-to-draw userItem's rectangle after the
  590. call to SetCTitle() doesn't seem to solve the problem; it's still updated.
  591.  
  592. As always, thanks in advance for whatever light you can shed on this...
  593.  
  594. - ------------------------------------------------------------------------------
  595. Christopher Tate             | The Leadfoot Collection, Continued:
  596. Management System Designers  |        * Red Barchetta (Rush)
  597.                              |        * Old Time Rock And Roll (Bob Seeger)
  598. fixer@faxcsl.dcrt.nih.gov    | Because driving fast is a cathartic experience.
  599.  
  600. +++++++++++++++++++++++++++
  601.  
  602. From: absurd@apple.apple.com (Tim Dierks, software saboteur)
  603. Date: Fri, 6 Nov 1992 22:42:36 GMT
  604. Organization: MacDTS Marauders
  605.  
  606. In article <1992Nov6.170232.21241@alw.nih.gov>, fixer@faxcsl.dcrt.nih.gov
  607. (Chris Spiral Catfish Tate) wrote:
  608. > Problem: calling SetCTitle() (and possibly SetCtlValue()) on controls in the
  609. > dialog is forcing an update.  This is pretty bad in my case, since redrawing
  610. > the dialog is rather time-consuming.
  611. > Does anyone have any idea what's happening, and how I might go about preventing
  612. > it?  Calling ValidRect() on the slow-to-draw userItem's rectangle after the
  613. > call to SetCTitle() doesn't seem to solve the problem; it's still updated.
  614.  
  615. Sure enough, controls will invalidate themselves (or the control manager
  616. does it; I can't remember).  This isn't the real problem; the problem is
  617. that your user items are being drawn when they don't need to be.  I would
  618. stick a little code at the beginning of your user item drawing procedure
  619. that makes sure that your user item intersects the union of the visRgn and
  620. the clipRgn; this way you can be sure that your user item actually
  621. needs to be redrawn before undertaking the task.  (For extra points,
  622. only redraw the bits that need to be redrawn.)
  623.  
  624. Tim Dierks
  625. MacDTS, why not?
  626.  
  627. +++++++++++++++++++++++++++
  628.  
  629. From: sokoloff@athena.mit.edu (James T Sokoloff)
  630. Date: 7 Nov 92 17:21:36 GMT
  631. Organization: Massachusetts Institute of Technology
  632.  
  633. In article <absurd-061192133636@seuss.apple.com> absurd@apple.apple.com (Tim Dierks, software saboteur) writes:
  634. >In article <1992Nov6.170232.21241@alw.nih.gov>, fixer@faxcsl.dcrt.nih.gov
  635. >(Chris Spiral Catfish Tate) wrote:
  636. >> Problem: calling SetCTitle() (and possibly SetCtlValue()) on controls in the
  637. >> dialog is forcing an update.  This is pretty bad in my case, since redrawing
  638. >> the dialog is rather time-consuming.
  639. >
  640. >Sure enough, controls will invalidate themselves (or the control manager
  641. >does it; I can't remember).  This isn't the real problem; the problem is
  642. >that your user items are being drawn when they don't need to be.  I would
  643. >stick a little code at the beginning of your user item drawing procedure
  644. >that makes sure that your user item intersects the union of the visRgn and
  645. >the clipRgn; this way you can be sure that your user item actually
  646. >needs to be redrawn before undertaking the task.  (For extra points,
  647. >only redraw the bits that need to be redrawn.)
  648. >
  649. >Tim Dierks
  650. The region to check is the Intersection (SectRgn) (I-184) of the visRgn
  651. & clipRgn.  The UnionRgn would (under most cases) not avoid any drawing.
  652. SectRgn will correctly compute the region of interest.
  653.  
  654. Other than that, this *is* the correct way to speed up the drawing...
  655. - ---Jim Sokoloff
  656.  
  657. +++++++++++++++++++++++++++
  658.  
  659. From: Bathsheba.Grossman@launchpad.unc.edu (Bathsheba Grossman)
  660. Date: 7 Nov 92 22:15:21 GMT
  661. Organization: University of North Carolina Extended Bulletin Board Service
  662.  
  663. >>(Chris Spiral Catfish Tate) wrote:
  664. >>> Problem: calling SetCTitle() (and possibly SetCtlValue()) on controls in the
  665. >>> dialog is forcing an update.  This is pretty bad in my case, since redrawing
  666. >>> the dialog is rather time-consuming.
  667.  
  668. >>stick a little code at the beginning of your user item drawing procedure
  669. >>that makes sure that your user item intersects the union of the visRgn and
  670. >>the clipRgn; this way you can be sure that your user item actually
  671. >>needs to be redrawn before undertaking the task.
  672.  
  673. >>Tim Dierks
  674. >The region to check is the Intersection (SectRgn) (I-184) of the visRgn
  675. >& clipRgn.  The UnionRgn would (under most cases) not avoid any drawing.
  676.  
  677. You don't have to do this SectRgn if you're using BeginUpdate/EndUpdate
  678. because BeginUpdate does it for you and puts the result in the visRgn,
  679. then EndUpdate puts it back to normal.
  680. Also, using UpdtDialog (IV-60) or UpdtControl (IV-53) instead of
  681. DrawDialog/DrawControls might just solve the whole problem.  (There, you
  682. knew IV was good for something.)
  683.  
  684. - -Sheba
  685.  
  686.  
  687. - --
  688.    The opinions expressed are not necessarily those of the University of
  689.      North Carolina at Chapel Hill, the Campus Office for Information
  690.         Technology, or the Experimental Bulletin Board Service.
  691.            internet:  laUNChpad.unc.edu or 152.2.22.80
  692.  
  693. +++++++++++++++++++++++++++
  694.  
  695. From: fixer@faxcsl.dcrt.nih.gov (Chris Spiral Catfish Tate)
  696. Date: 10 Nov 92 15:54:49 GMT
  697. Organization: Computer Systems Laboratory, DCRT, NIH
  698.  
  699. Thanks to everyone who responded, either on the net or via email.
  700.  
  701. In summary, what's happening is that indeed, SetCTitle() is *both* redrawing
  702. the control with its new title *and* causing an update event in the dialog.
  703. I'm not quite clear on why it has to generate the update event, but that's
  704. beside the point.
  705.  
  706. The update event is causing all userItem procedures installed for the dialog
  707. to be called, whether or not they actually intersect the updateRgn established
  708. by the invalidation of the control's bounding rectangle.  Checking to see
  709. whether each userItem actually *needs* to be redrawn prevents having to wade
  710. through all that (slow, DrawString) drawing unnecessarily.
  711.  
  712. If you're absolutely sure you don't have to update anything else when the
  713. control changes its title, you can also call ValidRect() on its rectangle
  714. immediately following the call to SetCTitle(), and the update will be
  715. "cancelled."
  716.  
  717. - ------------------------------------------------------------------------------
  718. Christopher Tate             | The Leadfoot Collection, Continued:
  719. Management System Designers  |        * Red Barchetta (Rush)
  720.                              |        * Old Time Rock And Roll (Bob Seeger)
  721. fixer@faxcsl.dcrt.nih.gov    | Because driving fast is a cathartic experience.
  722.  
  723. +++++++++++++++++++++++++++
  724.  
  725. From: keith@taligent.com (Keith Rollin)
  726. Date: 10 Nov 92 22:22:10 GMT
  727. Organization: Taligent
  728.  
  729. In article <1992Nov10.155449.14655@alw.nih.gov>, fixer@faxcsl.dcrt.nih.gov
  730. (Chris Spiral Catfish Tate) wrote:
  731. > Thanks to everyone who responded, either on the net or via email.
  732. > In summary, what's happening is that indeed, SetCTitle() is *both* redrawing
  733. > the control with its new title *and* causing an update event in the dialog.
  734. > I'm not quite clear on why it has to generate the update event, but that's
  735. > beside the point.
  736.  
  737. I looked into this when working on "Macintosh Programming Secrets." What
  738. happens when you call SetCTitle is the following:
  739.  
  740.     _HideControl
  741.     change the title of the control
  742.     _ShowControl
  743.  
  744. _HideControl calls _EraseControl and then invalidates the area under the
  745. control's bounds. This is correct behaviour for _HideControl. When
  746. _ShowControl is called, the control is redrawn, but the area is still
  747. marked invalid in the window's update region. The second drawing of the
  748. control is the dialog manager responding to the update.
  749.  
  750. > If you're absolutely sure you don't have to update anything else when the
  751. > control changes its title, you can also call ValidRect() on its rectangle
  752. > immediately following the call to SetCTitle(), and the update will be
  753. > "cancelled."
  754.  
  755. Right. Here's the section for MPS that deals with this issue. Note that it
  756. assumes that, if a dialog item is not a static or edit text item, that it
  757. is a control. This is not a valid assumption in all cases (as in the
  758. original poster's, who had user items in his dialog).
  759.  
  760. /*******************************************************************************
  761.  
  762.     SetDialogItemTitle
  763.  
  764.     Change the text associated with a particular dialog item. This is a little
  765.     tricky since there are two ways to change the text. If you are dealing
  766.     with an EditText or StatText (static text) item, you must call SetIText.
  767.     If you are dealing with a dialog item that is backed up by a Control
  768.     Manager control (like a simple button, radio button, or checkbox), you
  769.     must call SetCTitle.
  770.  
  771.     We determine what kind of dialog item we are dealing with by calling
  772.     GetDItem. Returned in the RkindS parameter is a number that identifies
  773.     what sort of item we are handling. First, we strip off the upper bit,
  774.     which identifies the item as being enabled or disabled. Once that bit is
  775.     removed, we can examine the kind of the item and act accordingly.
  776.  
  777.     Notice the special handling we give to controls when we call SetCTitle.
  778.     This is to take care of Rexcessive flashingS as Online Companion puts it.
  779.     When you call SetCTitle, the control manager first calls HideControl to
  780.     remove the control with its old text from the screen. It then changes the
  781.     controlUs title in the ControlRecord, and reshows the control by calling
  782.     ShowControl. At this point, the control is properly shown on the screen
  783.     with its correct, new title.
  784.  
  785.     However, thereUs a little time bomb lurking in the works. When HideControl
  786.     was called, the Control Manager called InvalRect on the area the control
  787.     occupied. Even though ShowControl was later called on the same area and
  788.     everything is drawn correctly, that rectangle is still marked as invalid
  789.     and is incorporated into the update region for the dialog. The event loop
  790.     at the heart of ModalDialog will then get an update event for that area
  791.     and redraw the button _again_! This can cause the button to flicker and
  792.     flash more than we would like. We already know that that area is
  793.     adequately drawn, so we tell the Event Manager to hoof it by validating it
  794.     with a call to ValidRect.
  795.  
  796. *******************************************************************************/
  797. void    SetDialogItemTitle(DialogPtr dlg, short item, Str255 *newTitle)
  798. {
  799.     short    iKind;
  800.     Handle    iHandle;
  801.     Rect    iRect;
  802.  
  803.     GetDItem(dlg, item, &iKind, &iHandle, &iRect);
  804.     iKind &= ~itemDisable;                // Strip off the enable/disable bit
  805.     if ((iKind == statText) || (iKind == editText)) {
  806.         SetIText(iHandle, *newTitle);
  807.     } else {
  808.         SetCTitle((ControlHandle) iHandle, *newTitle);
  809.         SetPort(dlg);
  810.         ValidRect(&iRect);
  811.     }
  812. }
  813.  
  814.  
  815. - -----
  816. Keith Rollin
  817. Phantom Programmer
  818. Taligent, Inc.
  819.  
  820. ---------------------------
  821.  
  822. End of C.S.M.P. Digest
  823. **********************
  824.